//物理防御减伤
/** attack1为所受到物理伤害，pdefense物防数值 */
function wufangjianshang(attack1,pdefense) {
    return  Math.ceil(Math.max(attack1-pdefense*1.3,(attack1*0.1)));
}
//法术防御减伤
/** attack2为所受到法术伤害，sefense法防数值 */
function fafangjianshang(attack2,sefense) {
    return  Math.ceil(Math.max(attack2-sefense*1.3,(attack2*0.1)));
}
//暴击伤害
/** attack为伤害（物理或者法术）数值 */
function baoji(attack) {
    return attack * 1.5;
}
//暴击概率
/** herodata表中抗暴数值，antiriot为抗暴数值，strikewei为暴击数值 */
function baojilv(antiriot,strike) {
    return Math.max((strike-antiriot),1000);
}
//命中概率
/** 为herodata表中闪避数值，dodge对方闪避数值，fit自身命中数值 */
function mingzhong(dodge,fit) {
    return Math.max((fit-(dodge*0.92)),1000);
}

//控制buff概率
/** probability为skill表中控制数值，control对方控制数值，resist自身扛控数值  */

function kongzhizengliang(control,resist,probability) {
    return Math.max((probability+(control-resist)),0);
}

//爆伤增伤百分比
/** 为herodata表中控制数值，burstdrop对方爆伤减免数值，burstdps自身爆伤数值 */
function baoshang(burstdrop,burstdps) {
    return Math.max((burstdrop-(burstdps*0.92))/10000,0.1);
}
//物理减伤
/** 为herodata表中数值，burstdrop对方物理免伤数值，pdefenseup自身物理增伤数值 */
function wushangjianmian(burstdrop,pdefenseup) {
    return Math.max((pdefenseup-(burstdrop*0.92))/10000,0.1);
}
//法术减伤
/** 为herodata表中数值，sefenseup对方法术免伤数值，pdefenseup自身法术增伤数值 */
function fashangjianmian(sefenseup,pdefenseup) {
    return Math.max((sefenseup-(pdefenseup*0.92))/10000,0.1);
}
//治疗增量
/** 为herodata表中数值，therapy对方受疗，treatment自身治疗 */
function zhiliaozengliang(therapy,treatment) {
    return (therapy+treatment)/10000;
}

//战力计算
/** 攻击、物防、法防、生命、暴击、抗暴、暴伤、爆伤减免、命中、闪避、控制、抗控、初始怒气、治疗、受疗、物攻提升、法攻提升、物理减伤、法术减伤、技能等级 */
function zhandouli(attack,pdefense,sefense,life,strike,antiriot,burstdps,burstdrop,fit,dodge,control,resist,initialanger,treatment,therapy,pdefenseup,sefenseup,pdefenseguard,efenseguard,skilldps) {
    return Math.ceil(attack*1.5+pdefense*3+sefense*3+life*0.8+strike*0.1+antiriot*0.1+(burstdps-15000)*0.1+burstdrop*0.1+(fit-9900)*0.1+dodge*0.1+control*0.1+resist*0.1+initialanger*0.1+treatment*0.1+therapy*0.1+pdefenseup*0.1+sefenseup*0.1+pdefenseguard*0.1+efenseguard*0.1+skilldps);
}

//武将升级攻击属性提升
/** lv为武将等级，attack为herograde表攻击提升参数 */
function shengjigongjitisheng(lv,attack) {
	
	 if (lv <=100){
        return lv * attack;
    }else if (lv<=205){
        return (100 * attack)+((lv-100) * (attack*3));
    }else if (lv<=250){
        return (100 * attack)+(105 * attack * 3)+((lv-205) * (attack*6));
    }else if (lv<=350){
        return (100 * attack)+(105 * attack * 3)+(45 * attack * 6)+((lv-250) * (attack * 9));
    }
     return (100 * attack)+(105 * attack * 3)+(45 * attack * 6)+((lv-250) * (attack * 9));
}

//武将升级物防属性提升
/** lv为武将等级，pdefense为herograde表物防提升参数 */
function shengjiwufangtisheng(lv,pdefense) {
 	
	 if (lv <=100){
        return lv * pdefense;
    }else if (lv<=205){
        return (100 * pdefense)+((lv-100) * (pdefense*3));
    }else if (lv<=250){
        return (100 * pdefense)+(105 * pdefense * 3)+((lv-205) * (pdefense*6));
    }else if (lv<=350){
        return (100 * pdefense)+(105 * pdefense * 3)+(45 * pdefense * 6)+((lv-250) * (pdefense * 9));
    }
     return (100 * pdefense)+(105 * pdefense * 3)+(45 * pdefense * 6)+((lv-250) * (pdefense * 9));
}
//武将升级法防属性提升
/** lv为武将等级，sefense为herograde表物防提升参数 */
function shengjifafangtisheng(lv,sefense) {
 	 	
	 if (lv <=100){
        return lv * sefense;
    }else if (lv<=205){
        return (100 * sefense)+((lv-100) * (sefense*3));
    }else if (lv<=250){
        return (100 * sefense)+(105 * sefense * 3)+((lv-205) * (sefense*6));
    }else if (lv<=350){
        return (100 * sefense)+(105 * sefense * 3)+(45 * sefense * 6)+((lv-250) * (sefense * 9));
    }
     return (100 * sefense)+(105 * sefense * 3)+(45 * sefense * 6)+((lv-250) * (sefense * 9));
}
//武将升级生命属性提升
/** lv为武将等级，life为herograde表物防提升参数 */
function shengjishengmingtisheng(lv,life) {
 	
	 if (lv <=100){
        return lv * life;
    }else if (lv<=205){
        return (100 * life)+((lv-100) * (life*3));
    }else if (lv<=250){
        return (100 * life)+(105 * life * 3)+((lv-205) * (life*6));
    }else if (lv<=350){
        return (100 * life)+(105 * life * 3)+(45 * life * 6)+((lv-250) * (life * 9));
    }
     return (100 * life)+(105 * life * 3)+(45 * life * 6)+((lv-250) * (life * 9));
}
